package com.jt.net;

import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author 金帮嘉诚 @date 2021-08-19 星期四 8:59
 */
public class Tomcat1 {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket =new ServerSocket(9998);

        while (true){
            Socket socket = serverSocket.accept();
            OutputStream out
                    = socket.getOutputStream();

            String context = "HTTP/1.1 200\r\n"+
                    "Content-Type: text/html;charset=UTF-8\r\n"+
                    "\r\n"+
                    "<h1>你是一个人</h1>";
            out.write(context.getBytes());
            socket.close();
        }
    }
}
